# Contributor: Leon Marz <main@lmarz.org>
# Maintainer: Leon Marz <main@lmarz.org>
pkgname=rizin-cutter
pkgver=2.1.0
pkgrel=0
pkgdesc="Reverse Engineering Platform powered by rizin"
url="https://cutter.re"
arch="all !armhf" # syntax-highlighting not available
license="GPL-3.0-only"
depends="rizin"
makedepends="
	cmake
	graphviz-dev
	python3-dev
	qt5-qtsvg-dev
	qt5-qttools-dev
	rizin-dev
	samurai
	syntax-highlighting-dev
	"
subpackages="$pkgname-dev"
_translations_commit=974298653ba71b958e1b6c83f6011f5fefff6236
source="$pkgname-$pkgver.tar.gz::https://github.com/rizinorg/cutter/archive/v$pkgver.tar.gz
	translations.tar.gz::https://github.com/rizinorg/cutter-translations/archive/$_translations_commit.tar.gz
	"
builddir="$srcdir/cutter-$pkgver"
options="!check" # upstream does not provide a testsuite

prepare() {
	default_prepare

	rmdir "$builddir/src/translations"
	mv "$srcdir/cutter-translations-$_translations_commit" "$builddir/src/translations"
}

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCUTTER_USE_BUNDLED_RIZIN=OFF \
		-DCUTTER_ENABLE_GRAPHVIZ=ON \
		-DCUTTER_ENABLE_PYTHON=ON

	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
444e27005b9348397097c0c2fd047a557dfd5e8d5d43df6a2ab345da48e26537025ce6f81b256fe765dc59bf5944952965637b84e96136b3025c3dc5bca3f2d6  rizin-cutter-2.1.0.tar.gz
11450631602e7bd81132650b3edd028d56b2f6343a9561fe8bf3281427d8d22b0296651414756236b8544f719c8d4fc11be44a843532c8c32fe21dd7a82066d2  translations.tar.gz
"
